/*
 * ANNOTATED AND DOCUMENTED BY Eduardo Sobrino
 * -----------------------------------------------------------------------------
 * Project    : General LDAP User Support (UNIX + Windows)
 * Contents   : Provide a class that define and implements a general support for
 *            : LDAP User.
 * Depends    : UNMANAGED C/C++
 * Compatible : The following code will complie/run on Win32 (Windows) and any
 *            : UNIX platform.
 * File       : LdapUser.h
 * Copywright : Open Knowledge (c) 2000
 * Author     : Eduardo Sobrino
 * Date       : Jun/2000
 * Updated    : Aug/2000  (Added support for message queue [WIN32 only])
 *            : May/2007  (Added code to Kif framework)
 */

#pragma once

#include "Win32.Net.LdapClient.h"

namespace Kif
{
namespace Win32
{
namespace Net
{
namespace Ldap
{

class LdapUser
{
   private:

   LdapClient *pLdap;                   // pointer to Ldap session object
   Kif::Win32::String UsersDN;          // user DN

   public:

   LdapUser(LdapClient *pInLdap,TCHAR *pInUsersDN)
   {
      pLdap = pInLdap ;
      UsersDN.Copy(pInUsersDN);
   }

   bool Delete(TCHAR *pUserId);
   bool Exists(TCHAR *pUserId);

   bool Find(TCHAR *pUserId,TCHAR *pAttr,TCHAR *pValue,int iValLen);

   bool Add(TCHAR *pAcct,TCHAR *pUserId,TCHAR *pPassword);
   bool Add(TCHAR *pUserId,TCHAR *pPassword)
   {
      return(Add(pUserId,pUserId,pPassword));
   }

   bool UpdateAccount(TCHAR *pAcct,TCHAR *pUserId,TCHAR *pNewPassword);
   bool SetPassword(TCHAR *pUserId,TCHAR *pNewPassword);
   bool Authenticate(TCHAR *pUserId,TCHAR *pNewPassword);

}  ;  // end of LdapUser

// -----------------------------------------------------------------------------

}  // end of Kif::Win32::Net::Ldap
}  // end of Kif::Win32::Net
}  // end of Kif::Win32
}  // end of Kif



